package 设计模式.k_代理模式;

import cn.hutool.log.StaticLog;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author caihe
 * @date 2023/3/13 14:56
 */
public class DrinkProxy implements Drink {

    private final AtomicInteger count;

    private final Drink drink;
    
    public DrinkProxy(Drink drink) {
        count = new AtomicInteger(0);
        this.drink = drink;
    }

    @Override
    public void drink() {
        StaticLog.info("第{}口", count.incrementAndGet());
        drink.drink();
    }
}
